<div id="tabs">
	<ul>
        <li  id="current"><?php echo $this->Html->link(__('Các bài viết', true), array('action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('Tạo bài viết mới', true), array('controller'=>'noidungs','action' => 'add')); ?></li>
	</ul>
</div>
<div class="z2forums index">
	<h2><?php __('Các bài viết trong diễn đàn');?></h2>
    	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% bài viết', true)
	));
	?>	</p>

	<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Tiêu đề';?></th>
			<th><?php echo 'Tác giả';?></th>
			<th><?php echo 'Trả lời/Lượt xem';?></th>
			<th><?php echo 'Bài viết mới nhất';?></th>
			<th class="actions"><?php __('Lựa chọn');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($z2forums as $z2forum):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $i//echo $z2forum['Z2forum']['id']; ?>&nbsp;</td>
		<td><?php 
                    echo $z2forum['Z2forum']['tieude'].', được viết: ';
                    if((date('d-m-y')-date('d-m-y',strtotime($z2forum['Z2forum']['ngaytao'])))==0)
                        echo "<strong>Hôm nay, ".date('H\hm',strtotime($z2forum['Z2forum']['ngaytao'])).'</strong>';
                    else
                        echo  date('d-m-y H\hm',strtotime($z2forum['Z2forum']['ngaytao'])); ?>&nbsp;</td>
		<td>
			<?php echo $z2forum['Nhanvien']['name']; ?>
		</td>
		<td><?php 
                 echo 'Lượt xem: '.number_format($z2forum['Z2forum']['luotxem'],0,',','.'); 
                 echo '<br>Phản hồi: '.number_format($z2forum['Z2forum']['soph'],0,',','.'); ?>&nbsp;</td>
		<td><?php echo $z2forum['Z2forum']['moinhat']; ?>&nbsp;</td>
		<td class="actions">
			<?php echo $this->Html->link(__('Xem', true), array('controller'=>'phanhoips','action' => 'add', $z2forum['Z2forum']['id'])); ?>
			<?php 
      //      if($z2forum['Z2forum']['nhanvien_id']==$idnhanvien)
        //        echo $this->Html->link(__('Edit', true), array('action' => 'edit', $z2forum['Z2forum']['id'])); ?>
			<?php 
          //  if($quyen=='admin')
             if($z2forum['Z2forum']['nhanvien_id']==$idnhanvien)
         
                echo $this->Html->link(__('Xóa', true), array('controller'=>'noidungs','action' => 'delete', $z2forum['Z2forum']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $z2forum['Z2forum']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
